using System;

namespace DeflateLib
{
    /// <summary>
    /// Creates compressor documented in the DELFATE spec. Allows
    /// to specify LZ77CompressionSettings as parameter.
    /// </summary>
    class LZ77CompressorFactory : CompressorFactory
    {
        LZ77CompressorSettings compressorSettings = LZ77CompressorSettings.Default;

        internal LZ77CompressorSettings CompressorSettings
        {
            get { return compressorSettings; }
            set 
            {
                if (value == null) throw new ArgumentNullException();
                compressorSettings = value; 
            }
        }

        internal LZ77CompressorFactory()
        {
        }

        internal LZ77CompressorFactory(LZ77CompressorSettings compressorSettings)
        {
            if (compressorSettings == null) throw new ArgumentNullException("compressorSettings");

            this.compressorSettings = compressorSettings;
        }

        public override ICompressor CreateCompressor()
        {
            return new LZ77Compressor(CompressorSettings);
        }
    }
}
